package com.and9.mchen.mcmusic.dao;

import java.util.List;

import com.and9.mchen.mcmusic.entity.Singer;
import com.and9.mchen.mcmusic.exception.DaoException;

/**
 * 
 * @author MC
 * @version  1.0
 */
public interface ISingerDao {
	
	String[] BASEPROPERTYNAMES={"name", "nickName", 
		"sex", "singerType", "nationality", "birthDate", "constellation", 
			"height", "bloodType", "brokerageFirm", "musicLocal"};
	
	String[] PROPERTYNAMESWITHOUTEXPERIENCE={"name", "nickName", 
		"sex", "singerType", "nationality", "birthDate", "constellation", 
			"height", "bloodType", "brokerageFirm", "musicLocal"};
	
	/**
	 * <p>
	 * 如果song对象为null<br/>
	 * 则返回-1
	 * </p>
	 * <p>
	 * 保存对象到数据库的时候，singer的id为null或者0即可<br/>
	 * 保存对象时，propertyNames只要传null即可<br/>
	 * </p>
	 * <p>
	 * 更新对象的时候，不准更新singer父类的属性<br/>
	 * 如果存在父类属性，则会修改propertyNames属性为singer属性
	 * </p>
	 * @param singer
	 * @param propertyNames
	 * @return
	 * 返回创建或者更新<tt>singer</tt>的成功次数
	 * @throws DaoException
	 */
	int createOrUpdateSinger(Singer singer, String... propertyNames) throws DaoException;

	/**
	 * <p>
	 * singer对象不能为null singer的imageUrl也不能为null<br/>
	 * 如果singer、 imageUrl的id <= 0 或 null 且 uniqueId不合法<br/>
	 * 返回  null
	 * </p> 
	 * @param singer
	 * @return
	 * 返回<tt/>singer</tt>与imageUrl创建关系成功的次数
	 * @throws DaoException
	 */
	int createSingerImageUrlRelevanceBySinger(Singer singer) throws DaoException;
	
	/**
	 * <p>
	 * singer对象不能为null singer的集合musicStyles也不能为null<br/>
	 * 如果singer、 musicStyles里的各个id <= 0 或 null 且 uniqueId不合法<br/>
	 * 返回  null
	 * </p> 
	 * @param singer
	 * @return
	 * 返回<tt/>singer</tt>与musicStyles创建关系成功的次数
	 * @throws DaoException
	 */
	int[] createSingerMusicStyleRelevanceBySinger(Singer singer) throws DaoException;
	
	/**
	 * <p>
	 * 如果id <= 0</br>
	 * 则返回-1
	 * </p>
	 * @param id
	 * @return
	 * 返回根据singer的<tt>id</tt>删除singer的成功次数
	 * @throws DaoException
	 */
	int deleteSingerBySingerId(long id) throws DaoException;
	
	/**
	 * <p>
	 * 根据album<tt>id</tt>返回singer
	 * </p> 
	 * @param id
	 * @return
	 * 返回singer
	 * @throws DaoException
	 */
	Singer getSingerByAlbumId(long id) throws DaoException;
	
	/**
	 * <p>
	 * 如果id <= 0<br/>
	 * 则返回null
	 * </p>
	 * <p>
	 * 如果返回结果为null 且 id > 0 <br/>
	 * 意味不存在该对象在此数据库
	 * </p> 
	 * @param id
	 * @return
	 * 根据singer的<tt>id</tt>查找singer<br/>
	 * 查找失败返回null
	 * @throws DaoException
	 */
	Singer getSingerBySingerId(long id) throws DaoException;
	
	/**
	 * <p>
	 * 如果uniqueId 是 null<br/>
	 * 则返回null
	 * </p> 
	 * @param uniqueId
	 * @return
	 * 根据singer的<tt>uniqueId</tt>查找singer<br/>
	 * 查找失败返回null
	 * @throws DaoException
	 */
	Singer getSingerBySingerUnqiueId(String uniqueId) throws DaoException;
	
	/**
	 * <p>
	 * 根据musicStyle的<tt>id</tt>和页数<tt>pageNum</tt>、每页显示的个数<tt>pageCount</tt>、排序返回<tt>orderBy</tt><br/>
	 * 返回singers
	 * </p> 
	 * @param id
	 * @param pageNum
	 * @param pageCount
	 * @param orderBy
	 * @return
	 * 返回singers
	 * @throws DaoException
	 */
	List<Singer> getSingersByMusciStyleId(long id, int pageNum, int pageCount, String orderBy) throws DaoException;
	
	/**
	 * <p>
	 * 根据song<tt>id</tt>返回singers
	 * </p> 
	 * @param id
	 * @return
	 * 返回singers
	 * @throws DaoException
	 */
	List<Singer> getSingersBySongId(long id) throws DaoException;
	
	/**
	 * <p>
	 * 根据musicStyle<tt>id</tt>返回数据库的singers的总个数
	 * </p> 
	 * @param id 
	 * @param id
	 * @return
	 * 返回singers个数
	 * @throws DaoException
	 */
	long getSingersCountByMusciStyleId(long id) throws DaoException;
	
	/**
	 * <p>
	 * singer对象不能为null singer的imageUrl也不能为null<br/>
	 * 如果singer、 imageUrl的id <= 0 或 null 且 uniqueId不合法<br/>
	 * 返回  null
	 * </p>
	 * @param singer
	 * @return
	 * 返回<tt/>singer</tt>与imageUrl删除关系成功的次数
	 * @throws DaoException
	 */
	int removeSingerImageUrlRelevanceBySinger(Singer singer) throws DaoException;
	
	/**
	 * <p>
	 * singer对象不能为null singer的集合musicStyles也不能为null<br/>
	 * 如果singer、 musicStyles里的各个id <= 0 或 null 且 uniqueId不合法<br/>
	 * 返回  null
	 * </p> 
	 * @param singer
	 * @return
	 * 返回<tt/>singer</tt>与musicStyles删除关系成功的次数
	 * @throws DaoException
	 */
	int[] removeSingerMusicStyleRelevanceBySinger(Singer singer) throws DaoException;
	

	
	/**
	 * <p>
	 * 如果id <= 0</br>
	 * 则返回-1
	 * </p>
	 * @param singer
	 * @return
	 * 返回根据<tt>singer</tt>创建singer和statistics成功的次数
	 * @throws DaoException
	 */
	int createSingerStatisticsRelevanceBySinger(Singer singer) throws DaoException;
	
	/**
	 * <p>
	 * 如果id <= 0</br>
	 * 则返回-1
	 * </p>
	 * @param singer
	 * @return
	 * 返回根据<tt>singer</tt>去除singer和statistics成功的次数
	 * @throws DaoException
	 */
	int removeSingerStatisticsRelevanceBySinger(Singer singer) throws DaoException;
	
	/**
	 * <p>
	 * 如果id <= 0</br>
	 * 则返回-1
	 * </p>
	 * @param singer
	 * @return
	 * 返回根据<tt>singer</tt>创建singer和introduction成功的次数
	 * @throws DaoException
	 */
	int createSingerIntroductionRelevanceBySinger(Singer singer) throws DaoException;
	
	/**
	 * <p>
	 * 如果id <= 0</br>
	 * 则返回-1
	 * </p>
	 * @param singer
	 * @return
	 * 返回根据<tt>singer</tt>去除singer和introduction成功的次数
	 * @throws DaoException
	 */
	int removeSingerIntroductionRelevanceBySinger(Singer singer) throws DaoException;
	
	int[] createSingerAlbumRelevanceBySinger(Singer singer) throws DaoException;
	
	int[] removeSingerAlbumRelevanceBySinger(Singer singer) throws DaoException;
	
}
